<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>铸铁型材供应商</title>
    
    
    <style>
        /* 全局样式 */
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            scroll-behavior: smooth; /* 平滑滚动 */
            background: #f4f6f8 url('https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=1200&q=80') no-repeat center top fixed;
            background-size: cover;
        }
        /* 添加一个半透明遮罩，保证内容清晰 */
        body::before {
            content: '';
            position: fixed;
            left: 0; top: 0; right: 0; bottom: 0;
            width: 100vw; height: 100vh;
            background: rgba(245, 247, 250, 0.82);
            z-index: 0;
            pointer-events: none;
        }
        main, header, .cases, .products, .about, .news, footer {
            position: relative;
            z-index: 1;
        }

        /* 顶部导航栏样式 */
        header {
            background-color: white;
            display: flex;
            justify-content: center; /* 导航栏内容居中 */
            align-items: center;
            padding: 15px 0;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        nav ul {
            list-style-type: none;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center; /* 列表项居中 */
        }

        nav ul li {
            margin: 0 20px;
        }

        nav ul li a {
            text-decoration: none;
            color: #333;
            font-size: 18px;
            transition: color 0.3s;
            position: relative;
        }

        nav ul li a:hover {
            color: #007bff;
        }

        nav ul li a::after {
            content: '';
            position: absolute;
            width: 0;
            height: 2px;
            bottom: -2px;
            left: 0;
            background-color: #007bff;
            transition: width 0.3s;
        }

        nav ul li a:hover::after {
            width: 100%;
        }

        /* 锚点定位偏移，避免被导航栏遮挡 */
        :target::before {
            content: "";
            display: block;
            height: 80px; /* 导航栏高度 */
            margin: -80px 0 0;
        }

        /* 横幅样式 */
        .banner {
            background-image: url('https://picsum.photos/1200/400?random=1');
            background-size: cover;
            background-position: center;
            height: 400px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .banner::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.3);
        }

        .banner h1 {
            color: white;
            font-size: 36px;
            z-index: 1;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
        }


        /* 产品中心样式 */
        .products {
            padding: 60px 50px;
        }

        .products h2 {
            margin-bottom: 30px;
            text-align: center;
            font-size: 30px;
            color: #333;
        }

        .product-item {
            display: inline-block;
            width: 200px;
            margin: 0 15px 30px 0;
            text-align: center;
        }

        .product-item img {
            width: 150px;
            height: 150px;
            object-fit: cover;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        /* 应用案例样式 */
        .cases {
            padding: 60px 50px;
            background-color: #f8f9fa;
        }

        .cases h2 {
            margin-bottom: 30px;
            text-align: center;
            font-size: 30px;
            color: #333;
        }

        .case-item {
            display: inline-block;
            width: 250px;
            margin: 0 15px 30px 0;
            text-align: center;
        }

        .case-item img,
        .case-item video {
            width: 220px;
            height: 160px;
            object-fit: cover;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        /* 关于我们样式 */
        .about {
            padding: 60px 50px;
            background-color: #f8f9fa;
            color: #333;
        }

        .about h2 {
            margin-bottom: 30px;
            text-align: center;
            font-size: 30px;
            color: #333;
        }

        .about img {
            width: 200px;
            height: 200px;
            float: right;
            margin-left: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        /* 新闻资讯样式 */
        .news {
            padding: 60px 50px;
        }

        .news h2 {
            margin-bottom: 30px;
            text-align: center;
            font-size: 30px;
            color: #333;
        }

        .news-item {
            margin-bottom: 20px;
            border: 1px solid #eaeaea;
            padding: 15px;
            border-radius: 8px;
            background-color: white;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        }

        .news-item .date {
            color: #666;
            margin-bottom: 5px;
            font-size: 14px;
        }

        /* 页脚样式 */
        footer {
            background-color: #333; /* 修改为深灰色背景 */
            color: white;
            text-align: center;
            padding: 30px;
        }

        footer a {
            color: #4da6ff; /* 调整链接颜色，提高对比度 */
            text-decoration: none;
        }

        footer a:hover {
            text-decoration: underline;
        }

        /* 文章弹窗样式 */
        .article-modal {
            display: none;
            position: fixed;
            z-index: 2000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.7);
        }

        .modal-content {
            background-color: white;
            margin: 5% auto;
            padding: 25px;
            border: 1px solid #ddd;
            width: 80%;
            max-width: 800px;
            color: #333;
            position: relative;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        .close-modal {
            color: #aaa;
            float: right;
            font-size: 30px;
            font-weight: bold;
            cursor: pointer;
        }

        .close-modal:hover,
        .close-modal:focus {
            color: #333;
            text-decoration: none;
        }

        .modal-title {
            font-size: 26px;
            margin-bottom: 15px;
            color: #007bff;
        }

        .modal-body {
            line-height: 1.7;
            font-size: 16px;
        }
        
        /* 统一的内容容器样式 */
        .content-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
        }

        /* 视频美化和弹窗样式 */
        .video-container {
            position: relative;
            margin: 20px auto;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 16px rgba(0,0,0,0.15);
            transition: box-shadow 0.3s;
            background: #fff;
        }
        .video-container:hover {
            box-shadow: 0 8px 32px rgba(0,0,0,0.25);
        }
        .bilibili-video {
            width: 100%;
            height: 220px;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            transition: box-shadow 0.3s;
        }
        @media (max-width: 600px) {
            .bilibili-video {
                height: 160px;
            }
        }
        /* 全屏弹窗样式 */
        .video-modal {
            display: none;
            position: fixed;
            z-index: 3000;
            left: 0;
            top: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0,0,0,0.85);
            align-items: center;
            justify-content: center;
        }
        .video-modal.active {
            display: flex;
        }
        .video-modal-iframe {
            width: 80vw;
            height: 45vw;
            max-width: 1000px;
            max-height: 70vh;
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.5);
            background: #000;
        }
        .video-modal-close {
            position: absolute;
            top: 30px;
            right: 50px;
            color: #fff;
            font-size: 48px;
            font-weight: bold;
            cursor: pointer;
            z-index: 10;
            transition: color 0.2s;
        }
        .video-modal-close:hover {
            color: #4da6ff;
        }

        /* 在<style>内添加关于我们部分的两列布局样式 */
        .about-container {
            display: flex;
            flex-wrap: wrap;
            gap: 40px;
            justify-content: center;
            align-items: flex-start;
            margin-top: 30px;
        }
        .about-section {
            flex: 1 1 320px;
            min-width: 280px;
            max-width: 480px;
            background: #fff;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.07);
            padding: 32px 28px 24px 28px;
            margin: 0;
        }
        .about-section h3 {
            margin-top: 0;
            margin-bottom: 18px;
            font-size: 22px;
            color: #007bff;
        }
        .about-section ul.news-list {
            padding-left: 18px;
        }
        @media (max-width: 900px) {
            .about-container {
                flex-direction: column;
                gap: 20px;
            }
            .about-section {
                max-width: 100%;
                padding: 22px 12px 16px 12px;
            }
        }

        #finished .slider-container {
            position: relative;
            width: 100%;
            overflow: hidden;
        }

        #finished .slider {
            display: flex;
            transition: transform 0.5s ease-in-out;
        }

        #finished .slider .product-item {
            flex: 0 0 calc(20% - 10px); /* 一行显示5张 */
            margin: 0 5px;
            box-sizing: border-box;
            cursor: pointer;
        }

        #finished .slider .product-item img {
            width: 100%;
            height: auto;
            transition: transform 0.3s ease;
        }

        #finished .slider .product-item img:hover {
            transform: scale(1.05);
        }

        /* 成品展示中的视频缩略卡片，尺寸/效果与图片一致 */
        #finished .slider .product-item .video-thumb {
            position: relative;
            width: 100%;
            padding-top: 56.25%; /* 16:9 */
            border-radius: 10px;
            background: #000;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease;
            cursor: pointer;
        }
        #finished .slider .product-item .video-thumb:hover {
            transform: scale(1.05);
        }
        #finished .slider .product-item .video-thumb::after {
            content: '';
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            width: 0; height: 0;
            border-left: 26px solid #fff;
            border-top: 16px solid transparent;
            border-bottom: 16px solid transparent;
            opacity: 0.9;
        }

        #finished .prev-btn, #finished .next-btn {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background: rgba(0, 0, 0, 0.5);
            color: white;
            border: none;
            padding: 15px;
            cursor: pointer;
            font-size: 18px;
            z-index: 1;
        }

        #finished .prev-btn { left: 10px; }
        #finished .next-btn { right: 10px; }

        /* 统一的图片放大模态框样式（仅此一套） */
        .image-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.8);
            justify-content: center;
            align-items: center;
            z-index: 3000;
        }
        .image-modal img {
            max-width: 90%;
            max-height: 90%;
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(0,0,0,0.5);
        }
        .image-modal-close {
            position: absolute;
            right: 25px;
            top: 10px;
            color: #fff;
            font-size: 40px;
            font-weight: bold;
            cursor: pointer;
            line-height: 1;
        }

        @media screen and (max-width: 768px) {
            .product-item {
                min-width: 50%;
            }
        }

        @media screen and (max-width: 480px) {
            .product-item {
                min-width: 100%;
            }
        }
        .cases { text-align: center; padding: 20px; }
        /* 统一：不要在全局强制 600px 宽，保持响应式更小比例 */
        /* 删除全局 600px 设置，使用 #finished 专属样式控制尺寸 */

        .prev-btn, .next-btn {
            position: absolute; top: 50%; transform: translateY(-50%);
            background-color: rgba(0,0,0,0.5); color: white;
            border: none; padding: 10px; cursor: pointer; border-radius: 50%;
        }
        .prev-btn { left: 10px; }
        .next-btn { right: 10px; }

        /* （删除重复的旧.modal样式，统一使用.image-modal） */
        #finished {
        width: 100%;
        margin: 0;
        padding: 0;
        
    }

    /* 整个展示区铺满屏幕 */
        #finished {
            width: 100%;
            margin: 0;
            padding: 0;
        }

        /* 容器全宽 */
        #finished .content-container {
            width: 100%;
            padding: 0;
        }

        /* 轮播区域 */
        .slider-container {
            position: relative;
            overflow: hidden;
            width: 100%;
        }

        /* 图片容器横向排列 */
        .slider {
            display: flex;
            transition: transform 0.5s ease;
        }

        /* 产品中心/应用案例缩略图适度缩小 */
        #products .product-item { width: 180px; }
        #products .product-item img { width: 160px; height: 120px; object-fit: cover; }
        #cases .case-item { width: 220px; }
        #cases .case-item img { width: 200px; height: 140px; object-fit: cover; }

        /* 左右按钮 */
        .prev-btn,
        .next-btn {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background-color: rgba(0,0,0,0.5);
            color: white;
            border: none;
            padding: 10px;
            cursor: pointer;
            z-index: 10;
        }

        .prev-btn { left: 10px; }
        .next-btn { right: 10px; }



    </style>
</head>

<body>
    <!-- 头部导航栏 -->
    <header>
        <nav>
            <ul>
                <li><a href="#products">产品中心</a></li>
                <li><a href="#cases">加工阀体</a></li>
                <li><a href="#finished">成品展示</a></li>
                <li><a href="#about">关于我们</a></li>
            </ul>
        </nav>
    </header>

    <div class="banner">
        <h1>专业铸铁型材供应商</h1>
    </div>

    <!-- 产品中心 -->
    <div id="products" class="products">
        <h2>产品中心</h2>
        
        <h3 style="text-align: center;">球墨铸铁棒</h3>
        <div class="content-container">
            <div class="product-item">
                <img src="https://gitee.com/zzj_01/wu-an_project/raw/master/qmztb/qmztb1.jpeg" alt="球墨铸铁棒产品图">
                <p></p>
            </div>
            <div class="product-item">
                <img src="https://gitee.com/zzj_01/wu-an_project/raw/master/qmztb/qmztb2.jpeg" alt="球墨铸铁棒产品图">
                <p></p>
            </div>
            <div class="product-item">
                <img src="https://gitee.com/zzj_01/wu-an_project/raw/master/qmztb/qmztb3.jpeg" alt="球墨铸铁棒产品图">
                <p></p>
            </div>
        </div>
        
        <h3 style="text-align: center;">方形铸铁棒</h3>
        <div class="content-container">
            <div class="product-item">
                <img src="https://gitee.com/zzj_01/wu-an_project/raw/master/fxztb/fxztb1.jpeg" alt="方形铸铁棒产品图">
                <p></p>
            </div>
        </div>
        
        <h3 style="text-align: center;">异型铸铁棒</h3>
        <div class="content-container">
            <div class="product-item">
                <img src="https://gitee.com/zzj_01/wu-an_project/raw/master/yxztb/yxztb1.jpeg" alt="异型铸铁棒产品图">
                <p></p>
            </div>
        </div>
        
        <h3 style="text-align: center;">灰铸铁棒</h3>
        <div class="content-container">
            <div class="product-item">
                <img src="https://gitee.com/zzj_01/wu-an_project/raw/master/hztb/hztb1.jpeg" alt="灰铸铁棒产品图">
                <p></p>
            </div>
            <div class="product-item">
                <img src="https://gitee.com/zzj_01/wu-an_project/raw/master/hztb/hztb2.jpeg" alt="灰铸铁棒产品图">
                <p></p>
            </div>
        </div>
    </div>

    <!-- 加工阀体 -->
    <div id="cases" class="cases">
        <h2>加工阀体</h2>
        <div class="content-container">
            <!-- 案例1：棒材表面加工 -->
            <div class="case-item">
                <div class="video-container">
                    <iframe 
                        src="https://player.bilibili.com/player.html?bvid=BV1CeNbznEPh&page=1" 
                        allowfullscreen="true" 
                        frameborder="0" 
                        class="bilibili-video">
                        <p>视频加载失败，请检查网络连接</p>
                    </iframe>
                </div>
                <p class="case-title">棒材表面加工</p>
            </div>
            
            <!-- 案例2：阀体铣面加工 -->
            <div class="case-item">
                <div class="video-container">
                    <iframe 
                        src="https://player.bilibili.com/player.html?bvid=BV1PXKwz7EoW&page=1" 
                        allowfullscreen="true" 
                        frameborder="0" 
                        class="bilibili-video">
                        <p>视频加载失败，请检查网络连接</p>
                    </iframe>
                </div>
                <p class="case-title">阀体铣面加工</p>
            </div>
            
            <!-- 案例3：阀体铣面精加工 -->
            <div class="case-item">
                <div class="video-container">
                    <iframe 
                        src="https://player.bilibili.com/player.html?bvid=BV1PXKwz7EoW&page=2" 
                        allowfullscreen="true" 
                        frameborder="0" 
                        class="bilibili-video">
                        <p>视频加载失败，请检查网络连接</p>
                    </iframe>
                </div>
                <p class="case-title">阀体铣面精加工</p>
            </div>
            
            <!-- 案例4：异形件加工 -->
            <div class="case-item">
                <div class="video-container">
                    <iframe 
                        src="https://player.bilibili.com/player.html?bvid=BV1NXKwz7EFE&page=1" 
                        allowfullscreen="true" 
                        frameborder="0" 
                        class="bilibili-video">
                        <p>视频加载失败，请检查网络连接</p>
                    </iframe>
                </div>
                <p class="case-title">异形件加工</p>
            </div>
            <!-- 案例5：-->
            <div class="case-item">
                <div class="video-container">
                    <iframe 
                        src="https://player.bilibili.com/player.html?isOutside=true&aid=114869000997057&bvid=BV1V5gTzpERn&cid=31111056573&p=1"
                        allowfullscreen="true" 
                        frameborder="0" 
                        class="bilibili-video">
                        <p>视频加载失败，请检查网络连接</p>
                    </iframe>
                </div>
                <p class="case-title">异形件加工</p>
            </div>
        </div>
    </div>

    <div id="finished" class="cases">
        <h2>成品展示</h2>
        <div class="content-container">
            <div class="slider-container" id="slider-container">
                <div class="slider" id="slider">
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs1.jpeg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs2.jpeg"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs3.jpeg"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs4.jpeg" alt="成品展示图"></div>
                     <!-- 视频缩略卡片（与图片一致的大小/交互） -->
                     <div class="product-item">
                         <div class="video-thumb" data-video-src="https://player.bilibili.com/player.html?isOutside=true&aid=114869017776063&bvid=BV15GgTz9EeQ&cid=31111185175&p=1"></div>
                     </div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs6.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs7.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs8.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs9.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs10.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs11.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs12.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs13.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs14.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs15.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs16.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs17.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs18.jpg" alt="成品展示图"></div>
                    <div class="product-item"><img src="https://gitee.com/zzj_01/wu-an_project/raw/master/cpzs/cpzs19.jpg" alt="成品展示图"></div>
                    <!-- 继续添加你的图片 -->
                </div>
                <button class="prev-btn" id="prev">&#10094;</button>
                <button class="next-btn" id="next">&#10095;</button>
            </div>
        </div>
    </div>
    
    
    

    <!-- 关于我们 -->
    <div id="about" class="about">
        <h2>关于我们</h2>
        <div class="about-container">
          <div class="about-section">
            <h3>1、公司简介</h3>
            <p style="text-indent: 2em;">
              武安市航铁贸易有限公司，位于河北省邯郸市武安市有着良好的地理和交通优势。我司专业经销球墨铸铁型材、灰铁棒等。拥有自营进出口权，可加工各种规格的铸铁型材，拥有卓越的加工能力。
            </p>
          </div>
      
          <div class="about-section">
            <h3>2、公司新闻</h3>
            <p><a href="#" class="article-link">水平连铸球墨铸铁型材用途及简介</a></p>
            <p><a href="#" class="article-link">球墨铸铁连铸型材的特性</a></p>
            <p><a href="#" class="article-link">水平连铸铸铁型材的组织及力学性能特点</a></p>
          </div>
        </div>
      </div>

    <!-- 页脚 -->
    <footer>
        <p>地址：河北邯郸市邯山区g107与海园南路交叉口</p>
        <p>联系人：牛经理</p>
        <p>电话：18730099881</p>
        <p>邮箱：<a href="mailto:18731092528@163.com">18731092528@163.com</a></p>
        <!--<img src="https://picsum.photos/100/100?random=15" alt="二维码">-->
    </footer>

    <!-- 视频全屏弹窗 -->
    <div class="video-modal" id="video-modal">
        <span class="video-modal-close" id="video-modal-close">&times;</span>
        <iframe class="video-modal-iframe" id="video-modal-iframe" src="" allowfullscreen="true" frameborder="0"></iframe>
    </div>

    <!-- 图片放大模态框（全站唯一） -->
    <div id="imageModal" class="image-modal">
        <span class="image-modal-close">&times;</span>
        <img id="modalImage" alt="放大图">
    </div>

    <script>
        // 视频放大功能
        const videos = document.querySelectorAll('.normal-video');
        videos.forEach((video) => {
            video.addEventListener('click', function () {
                this.classList.add('enlarged');
                this.classList.remove('normal-video');
            });
        });

        // 统一图片放大（全站复用同一个模态框）
        const imageModal = document.getElementById('imageModal');
        const imageModalImg = document.getElementById('modalImage');
        const imageModalClose = document.querySelector('#imageModal .image-modal-close');
        const videoModal = document.getElementById('video-modal');
        const videoIframe = document.getElementById('video-modal-iframe');
        const videoModalClose = document.getElementById('video-modal-close');

        document.addEventListener('click', function (e) {
            const target = e.target;
            if (target && target.matches('.product-item img, .case-item img')) {
                imageModalImg.src = target.src;
                imageModal.style.display = 'flex';
                return;
            }
            // 点击视频缩略卡片
            if (target && (target.matches('.video-thumb') || target.closest('.video-thumb'))) {
                const thumb = target.closest('.video-thumb');
                const src = thumb.getAttribute('data-video-src');
                if (src) {
                    // 强制关闭自动播放
                    const withAutoplayOff = (url) => {
                        if (url.includes('autoplay=')) {
                            return url.replace(/autoplay=1/gi, 'autoplay=0');
                        }
                        return url + (url.includes('?') ? '&' : '?') + 'autoplay=0';
                    };
                    videoIframe.src = withAutoplayOff(src);
                    videoModal.classList.add('active');
                }
                return;
            } else if (target === imageModal || target === imageModalClose) {
                imageModal.style.display = 'none';
                imageModalImg.src = '';
            }
        });

        document.addEventListener('keydown', function (e) {
            if (e.key === 'Escape' && imageModal.style.display === 'flex') {
                imageModal.style.display = 'none';
                imageModalImg.src = '';
            }
            if (e.key === 'Escape' && videoModal.classList.contains('active')) {
                videoModal.classList.remove('active');
                videoIframe.src = '';
            }
        });

        // 点击关闭视频模态或遮罩关闭
        videoModalClose.addEventListener('click', function () {
            videoModal.classList.remove('active');
            videoIframe.src = '';
        });
        videoModal.addEventListener('click', function (e) {
            if (e.target === videoModal) {
                videoModal.classList.remove('active');
                videoIframe.src = '';
            }
        });

        document.addEventListener('click', function (event) {
            if (!event.target.matches('video')) {
                const enlargedVideo = document.querySelector('.enlarged');
                if (enlargedVideo) {
                    enlargedVideo.classList.add('normal-video');
                    enlargedVideo.classList.remove('enlarged');
                }
            }
        });
        // 文章弹窗功能
        document.addEventListener('DOMContentLoaded', function () {
            // 创建文章弹窗容器
            const modalContainer = document.createElement('div');
            modalContainer.id = 'article-modal-container';
            modalContainer.className = 'article-modal';
            modalContainer.innerHTML = `
                <div class="modal-content">
                    <span class="close-modal">&times;</span>
                    <h2 class="modal-title"></h2>
                    <div class="modal-body"></div>
                </div>
            `;
            document.body.appendChild(modalContainer);

            // 文章数据
            const articles = {
                '水平连铸球墨铸铁型材用途及简介': `
                    <p>&nbsp;&nbsp;球墨铸铁是一种新型的高强度铸铁材料，它与普通灰铁、孕育铸铁不同之点是球铁中的石墨不是片状而是呈球状，石墨由片状变为球状，使铸铁性能产生一个飞跃。</p>
                    <p>&nbsp;&nbsp;球墨铸铁型材，水平连铸，是通过球化和孕育处理得到球状石墨，有效地提高了铸铁的机械性能，特别是提高了塑性和韧性，从而得到比碳钢还高的强度。球墨铸铁其综合性能接近于钢，正是基于其优异的性能，已成功地用于铸造一些受力复杂，强度、韧性、耐磨性要求较高的零件。球墨铸铁已迅速发展为仅次于灰铸铁的、应用十分广泛的铸铁材料。所谓"以铁代钢"，主要指球铁。</p>
                    <p>&nbsp;&nbsp;球墨铸铁棒具有良好的韧性、强度高、耐磨、耐高温、耐腐蚀、产品表面光滑、尺寸精度高，从而提供了优越的机械性能和物理性能，在机械产品行业有一个很宽广的使用范围。</p>
                    <p>&nbsp;&nbsp;产品用途----主要用于制造曲轴、齿轮、活塞、液压缸盖、轴承、液压阀、气门导套、玻璃模具、法兰盘、固定侧板等多种机械零件...</p>
                    <p>&nbsp;&nbsp;相对于中低碳钢，使用连续铸铁加工的零部件，同比重量降低24%，人工加工成本节省66%，刀具节省70%；而对于砂铸件，连续铸铁基体组织致密，耐油压、气密性和成品率高的特点更为突出。为更多的机械制造行业提供整套高品质、低成本、低能耗的解决方案。</p>
                `,
                '球墨铸铁连铸型材的特性': `
                    <p>球墨铸铁连铸型材通过球化和孕育处理得到球状石墨，有效地提高了铸铁的机械性能，特别是提高了塑性和韧性。</p>
                    <p>主要特性：</p>
                    <ol>
                        <li>不使用砂型或涂料等传统造型材料，所以连铸型材不会有因砂型铸造而引起的缺陷</li>
                        <li>采用水冷石墨和铸件凝固时与保温炉内大量铁水相连，温度梯度较大，极大限度地减少了缩孔(松)，组织细小致密，材料均匀性好</li>
                        <li>材料表面光洁度高，尺寸精度高</li>
                        <li>型材品质稳定，不易产生波动</li>
                    </ol>
                    <p>与传统砂型铸造相比，连铸型材的组织更加致密，性能更加稳定，适合大批量生产高质量零件。</p>
                `,
                '水平连铸铸铁型材的组织及力学性能特点': `
                    <p>水平连铸铸铁型材的组织和性能与传统铸造方法有显著差异，主要归因于其独特的凝固过程。</p>
                    <p>组织特点：</p>
                    <ol>
                        <li>灰铸铁型材的显微组织为细小片状石墨（外围为一层细小的D型石墨，内部为细小的A型石墨）和铁素体及珠光体基体</li>
                        <li>球墨铸铁型材组织中石墨球细小圆整，球化率高，球数多，无晶间碳化物，机械性能兼有高强度和高塑性。球墨铸铁型材经热处理后更可以获得各种需要的基体组织及性能，与砂铸球铁相比，在强度相同时，其延伸率提高50%</li>
                        <li>采用水平连铸和封闭结晶器的工艺使型材表面质量好，尺寸精度高，无夹砂、夹渣、气孔、缩孔等铸造缺陷，加工成品率大大高于砂铸件</li>
                    </ol>
                    <p>力学性能特点：</p>
                    <ol>
                        <li>弹性模数高，铸铁型材弹性模数全断面各部位比一般砂型铸铁件高且均匀</li>
                        <li>疲劳极限强度较高，疲劳比与一般砂型铸铁相比约高50%</li>
                        <li>良好的耐压性能。当压力高达40MPa时，壁厚1mm的试样无点渗和周渗现象</li>
                        <li>机械加工性能良好，与砂铸件对比同材质型材切削性能好，铸铁型材切削抗力大于砂铸铸铁件而小于钢件；表面光洁度好，与砂铸铸铁件、钢件对比，铸铁型材在不同速度下切削，表面光洁度相对波动小，不仅在低速(＜50m／min)切削，而且在高速(＞200m／min)切削时，均能保证表面粗糙度不大于20μm</li>
                        <li>铸铁型材表面进行玻璃、搪瓷涂层，铜、铬、钨电镀，渗碳、氮处理等表面处理，性能远好于砂铸铸铁件</li>
                        <li>铸铁型材材质、形状和尺寸规格多，生产周期短，供货迅速</li>
                        <li>铸铁型材可连续生产，生产率高，劳动条件好，排污少，产品质量稳定</li>
                    </ol>
                    <p>这些特点使得水平连铸型材特别适合制造高精度、高强度的机械零件。</p>
                `,
                '球墨铸铁连铸型材的用途': `
                    <p>球墨铸铁连铸型材凭借其优异的综合性能，在众多领域得到广泛应用：</p>
                    <p>1. 汽车工业：</p>
                    <ul>
                        <li>刹车系统部件：制动钳、制动盘等</li>
                        <li>悬挂系统部件：转向节、控制臂等</li>
                        <li>发动机零件：曲轴、凸轮轴等</li>
                    </ul>
                    <p>2. 工程机械：</p>
                    <ul>
                        <li>液压系统阀体：高压阀块、泵体等</li>
                        <li>传动部件：齿轮、轴套等</li>
                        <li>结构件：高强度连接件</li>
                    </ul>
                    <p>3. 机床制造：</p>
                    <ul>
                        <li>导轨：高精度机床导轨</li>
                        <li>主轴箱：高强度、减震性好的箱体</li>
                        <li>夹紧装置：耐磨、高刚性零件</li>
                    </ul>
                    <p>4. 其他领域：</p>
                    <ul>
                        <li>电力行业：高压开关零件</li>
                        <li>船舶工业：螺旋桨、泵体等</li>
                        <li>农业机械：耐磨零件、传动部件</li>
                    </ul>
                    <p>随着材料技术的发展，球墨铸铁连铸型材的应用范围还在不断扩大，特别是在要求高强度、高精度的场合逐步替代锻钢和其他材料。</p>
                `
            };

            // 为新闻链接添加点击事件
            const newsLinks = document.querySelectorAll('.about a');
            newsLinks.forEach(link => {
                link.addEventListener('click', function (e) {
                    e.preventDefault();
                    const title = this.textContent;
                    const content = articles[title] || '文章内容正在准备中...';

                    // 填充弹窗内容
                    document.querySelector('.modal-title').textContent = title;
                    document.querySelector('.modal-body').innerHTML = content;

                    // 显示弹窗
                    modalContainer.style.display = 'block';
                });
            });

            // 关闭弹窗
            document.querySelector('.close-modal').addEventListener('click', function () {
                modalContainer.style.display = 'none';
            });

            // 点击弹窗外部关闭
            modalContainer.addEventListener('click', function (e) {
                if (e.target === modalContainer) {
                    modalContainer.style.display = 'none';
                }
            });

            // ESC键关闭弹窗
            document.addEventListener('keydown', function (e) {
                if (e.key === 'Escape' && modalContainer.style.display === 'block') {
                    modalContainer.style.display = 'none';
                }
            });
        });

        // （删除一套重复且存在变量问题的轮播逻辑）
        
        const slider = document.getElementById('slider');
        const prevBtn = document.getElementById('prev');
        const nextBtn = document.getElementById('next');

        let currentIndex = 0;
        const items = slider.querySelectorAll('.product-item');
        const visibleCount = 5; // 一次显示的图片数量（与每项20%对应）
        const totalItems = items.length;

        function updateSlider() {
            const itemWidth = items[0].offsetWidth + 10; // 图片宽度 + 间距
            slider.style.transform = `translateX(-${currentIndex * itemWidth}px)`;
        }

        nextBtn.addEventListener('click', () => {
            if (currentIndex < totalItems - visibleCount) {
                currentIndex++;
                updateSlider();
            }
        });

        prevBtn.addEventListener('click', () => {
            if (currentIndex > 0) {
                currentIndex--;
                updateSlider();
            }
        });

        // 自动播放
        let autoPlay = setInterval(() => {
            if (currentIndex < totalItems - visibleCount) {
                currentIndex++;
            } else {
                currentIndex = 0;
            }
            updateSlider();
        }, 3000);

        // 鼠标进入暂停
        document.getElementById('slider-container').addEventListener('mouseenter', () => {
            clearInterval(autoPlay);
        });

        // 鼠标离开恢复
        document.getElementById('slider-container').addEventListener('mouseleave', () => {
            autoPlay = setInterval(() => {
                if (currentIndex < totalItems - visibleCount) {
                    currentIndex++;
                } else {
                    currentIndex = 0;
                }
                updateSlider();
            }, 3000);
        });


    </script>
</body>

</html>